<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <script src="http://www.kuibutech.com/editorJfinalProject/js/jquery-1.7.1.js"></script>
    <link rel="stylesheet" href="http://www.kuibutech.com/editorJfinalProject/css/bootstrap.min.css">
    <title>上传标题图片</title>
</head>
<body>
<div align="center" style="display:block" align="center">
    <form action="/editorJfinalProject/edit/uploadNewTitleImage" method="post" enctype="multipart/form-data">
        <div class="form-group">
            <label for='imagename'>
                上传图片：
            </label>
        </div>
        <div class="form-group">
            <input type="file" style="width: 200px;height: 80px;" name="titleImage" id='imagename'/>
            <p class="help-block">请上传jpg,gif格式图片</p>
        </div>
        <input type="hidden" name="pageId" value="${pageId}">
        <div class="form-group">
            <input type="submit" style="width: 200px;height: 60px;" class="btn-primary" value="提交" onclick="return SureSubmit(this.form)"/>
            &nbsp;&nbsp;
            <input type="reset" style="width: 200px;height: 60px;" class="btn-primary" value="重置"/>
        </div>
    </form>

    <a href="/editorJfinalProject/page/gotoFirstPage/1-1">
        返回我的编辑</a>
</div>
</body>
<!--script 代码部分-->
<script type="text/javascript">
    function verifyForm(objForm) {

        //取得上传文本框的值
        var imagefile = objForm.imagename.value;

        //取得上传文件扩展名
        var ext = imagefile.substring(imagefile.length - 3).toLowerCase();
        if (ext != "jpg" && ext != "gif" && ext != "bmp" && ext != "png") {
            alert("只允许上传gif、jpg、bmp、png！");
            return false;
        }
        return true;
    }
    function SureSubmit(objForm) {

        //验证通过则提交表单
        if (verifyForm(objForm)) objForm.submit();
        return false;
    }
</script>
<!--script 代码部分-->
</html>